package com.example.demo.vo

import com.example.demo.dao.TPressureDao
import com.example.demo.dbmodels.TPressure
import io.swagger.annotations.ApiModelProperty
import me.liuwj.ktorm.dsl.QueryRowSet

class PressureVo {

    @ApiModelProperty("id")
    var id: Int? = null

    @ApiModelProperty("病人id")
    var patientId: Int? = null

    @ApiModelProperty("病人姓名")
    var patientName: String? = null

    @ApiModelProperty("科室id")
    var deptId: Int? = null

    @ApiModelProperty("科室名称")
    var deptName: String? = null

    @ApiModelProperty("床位Id")
    var bedId: Int? = null

    @ApiModelProperty("床位名称")
    var bedName: String? = null

    @ApiModelProperty("测量日期")
    var date: String? = null

    @ApiModelProperty("收缩压")
    var highPress: String? = null

    @ApiModelProperty("舒张压")
    var lowPress: String? = null

    @ApiModelProperty("心率")
    var heartRate: String? = null

    fun getVo(queue: QueryRowSet): PressureVo {
        queue.let {
            val data = PressureVo()
            data.id = it[TPressureDao.id]
            data.bedId = it[TPressureDao.bedId]
            data.bedName = it[TPressureDao.bedName]
            data.date = it[TPressureDao.date]
            data.deptId =  it[TPressureDao.deptId]
            data.deptName =  it[TPressureDao.deptName]
            data.patientId =  it[TPressureDao.patientId]
            data.patientName =  it[TPressureDao.patientName]
            data.highPress = it[TPressureDao.highPress]
            data.lowPress = it[TPressureDao.lowPress]
            data.heartRate = it[TPressureDao.heartRate]
            return data
        }
    }

    fun getVo(table: TPressure): PressureVo {
        table.let {
            val data = PressureVo()
            data.id = it.id
            data.bedId = it.bedId
            data.bedName = it.bedName
            data.date = it.date
            data.deptId = it.deptId
            data.deptName = it.deptName
            data.heartRate = it.heartRate
            data.highPress = it.highPress
            data.lowPress = it.lowPress
            data.patientId = it.patientId
            data.patientName = it.patientName
            return data
        }
    }

    fun getVoList(table: List<TPressure>): List<PressureVo> {
        table.let {
            val dataList = mutableListOf<PressureVo>()
            it.forEach {
                val data = PressureVo()
                data.id = it.id
                data.bedId = it.bedId
                data.bedName = it.bedName
                data.date = it.date
                data.deptId = it.deptId
                data.deptName = it.deptName
                data.heartRate = it.heartRate
                data.highPress = it.highPress
                data.lowPress = it.lowPress
                data.patientId = it.patientId
                data.patientName = it.patientName
                dataList.add(data)
            }
            return dataList
        }
    }


}